package com.cloud.pole.shop.biz.goods;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Options;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.goods.ShopGoodsCategoryRecommMapper;
import com.cloud.pole.mapper.goods.ShopGoodsModelAttrMapper;
import com.cloud.pole.shop.model.entity.goods.ShopGoods;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsCategoryRecomm;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsModelAttr;
import com.cloud.pole.shop.model.entity.shops.ShopShopsQualificate;
import com.cloud.pole.shop.model.vo.goods.ShopGoodsCategoryRecommVo;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

@Service
@Transactional(rollbackFor = Exception.class)
public class ShopGoodsCategoryRecommBiz extends BaseBiz<ShopGoodsCategoryRecommMapper, ShopGoodsCategoryRecomm> {
	
	@Cache(key="shopGoodsCategoryRecomm{1}")
    public ShopGoodsCategoryRecomm selectByPrimaryKey(Integer id) {
		 return mapper.selectByPrimaryKey(id);
    }
	
	@Cache(key="goodsCategoryRecommList{1}shopId-categoryRecomm{2}-recommPosId")
	public List<ShopGoodsCategoryRecommVo> selectListByShopId(Integer shopId, Integer recommPosId) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("shopId", shopId);
		map.put("recommPosId", recommPosId);
		map.put("showStatus", ShopGoodsCategoryRecommVo.SHOW_STATUS_YES);
		map.put("recommStatus", ShopGoodsCategoryRecommVo.RECOMM_STATUS_OK);
		return mapper.selectListByMap(map);
	}
}
